/*
 * llds.h
 *
 *  Created on: Jul 14, 2009
 *      Author: azoulaii
 */

#ifndef LLDS_H_
#define LLDS_H_

#include "disk.h"

class LowLevelDiskServices{
private:
	Disk *_disk;
	FreeBlockManager *_block_manager;
	InodeManager *_inode_manager;

	inode *createInode();
	void addBlocks(inode* iNode,int blocks);
	void reduceBlocks(inode* iNode,int blocks);
public:
	LowLevelDiskServices(Disk *d,FreeBlockManager *bmanager,InodeManager *imanager);
	int allocateInode();
	int allocateDataBlock();
	void freeDataBlock(int block_number);
	type getInodeType(int i_number);
	void setInodeType(int i_number,type file_type);
	void setDataBlock(int i_number,int i,int d_block_num);
	int getDataBlock(int i_number,int i);
	void readBlock(int block_number,char *buffer);
	void writeBlock(int block_number,char *new_data);
	int getFileSize(int i_number);
	void setFileSize(int i_number,int new_size);
	void freeInode(int i_number);
	general_data* getGeneralData();
	void createRoot();

};


#endif /* LLDS_H_ */
